package org.xiangfei.manager.util;

import java.io.Serializable;

public class Result implements Serializable {

	public static final String ERROR = "-1";// 服务器内部错误
	public static final String SUCCESS = "0";// 成功

	public static final String SUCCESS_MESSAGE = "成功";

	public static final String ERROR_MESSAGE = "失败";
	private String code;

	private String message;

	private Object data;

	public Result() {

	}

	public Result(String code, String message) {
		super();
		this.code = code;
		this.message = message;
	}
	
	

	public Result(String code, String message, Object data) {
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public static Result success(Object data) {
		return new Result(SUCCESS, SUCCESS_MESSAGE, data);

	}

	public static Result success() {
		return new Result(SUCCESS, SUCCESS_MESSAGE);

	}

	public static Result error(Object data) {
		return new Result(ERROR, ERROR_MESSAGE, data);
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

}
